package com.pioneer.gui.invoice.view;

import com.pioneer.beans.invoice.InvoiceHeaderModel;
import com.pioneer.gui.invoice.model.InvoiceModel;

import com.pioneer.gui.invoice.util.InvoiceDAO;
import com.pioneer.gui.invoice.controller.SaveButtonAdapter;
import com.pioneer.gui.invoice.controller.NewButtonAdapter;
import com.pioneer.gui.invoice.controller.InsertRowButtonAdapter;
import com.pioneer.gui.invoice.controller.DeleteRowButtonAdapter;

import javax.swing.JPanel;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;

import javax.swing.JFrame;

import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.util.Vector;

public class NavigationPanel
extends JPanel
{
	
	//public JButton saveButton;
	//public JButton shipButton;
	//public JButton insertButton;
	//public JButton deleteButton;
	
	//private InvoicePanel panel;
	
	public NavigationPanel(InvoiceModel model,DetailsPanel detailsPanel)
	{
		//this.panel=panel;
		//InvoiceModel model=panel.model;
		//DetailsPanel invoiceDetails=panel.detailsSection;
		//JFrame frame=panel.invoiceFrame;
		
		this.setLayout(new GridLayout(2,3));
		
		NavButton insertButton=new NavButton("Insert Row");
		insertButton.addActionListener(new InsertRowButtonAdapter(model));
		this.add(insertButton);
		//this.add(new Box(BoxLayout.Y_AXIS).createHorizontalStrut(8));
		
		NavButton deleteButton=new NavButton("Delete Row");
		deleteButton.addActionListener(new DeleteRowButtonAdapter(model,detailsPanel));
		this.add(deleteButton);
		//this.add(new Box(BoxLayout.Y_AXIS).createHorizontalStrut(8));
		
		NavButton saveButton=new NavButton("Save");
		saveButton.addActionListener(new SaveButtonAdapter(model));
		this.add(saveButton);		
		//this.add(new Box(BoxLayout.Y_AXIS).createHorizontalStrut(8));
		
		NavButton shipButton=new NavButton("Ship");
		this.add(shipButton);
		//this.add(new Box(BoxLayout.Y_AXIS).createHorizontalStrut(8));		

		NavButton newButton=new NavButton("New");
		newButton.addActionListener(new NewButtonAdapter(model));
		this.add(newButton);			
	}
	
	class NavButton
	extends JButton
	{
		NavButton(String label)
		{
			super(label);
			this.setPreferredSize(new Dimension(1,1));
		}
	}
}